<?php
declare (strict_types = 1);

namespace app\admin\controller;

use app\common\model\MonthTable;
use think\facade\View;

class Adminloginlogs extends Common
{
    protected $modelClass = \app\common\model\Rabc\AdminLoginLogs::class;
    protected $withModel   = ['admin'];
    // 允许访问的方法
    protected $public_method = ['index', 'delete'];

    protected function setSearchWhereFilter(array &$params = []):void
    {
        parent::setSearchWhereFilter($params); // TODO: Change the autogenerated stub

        if ( isset($params['admin_id']) && $params['admin_id'] > -1 ) {
            $params['where'][] = ['admin_id', '=', $params['admin_id']];
        }

        if ( isset($params['log_status']) && $params['log_status'] > -1 ) {
            $params['where'][] = ['log_status', '=', $params['log_status']];
        }

        // 管理员列表
        View::assign('admins', \app\admin\model\Admins::getInstance()->getSelectLists());
        // 获取所有分表月份的列表
        View::assign('all_monthes', MonthTable::getInstance()->getAllMonthes());
    }
}
